(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";

(function () {
    var template = function template(self) {
        return "<aux-view class=\"mask\"></aux-view><div class=\"image\"></div><img src=\"\">";
    };

    function onImageLoaded(self) {
        return function (e) {
            var naturalSize = window.aui.getNaturalSize(self.$ele.img);
            if (!self.classList.contains("loaded")) {
                self.classList.add("loaded");
                self.loaded = true;
            }
            self.$ele.lay.style.backgroundImage = "url(" + self.$src + ")";
            self.dispatchEvent(new CustomEvent("myload", {
                detail: naturalSize
            }));
        };
    }

    function onImageError(self) {
        return function (e) {
            self.dispatchEvent(new CustomEvent("myerror", {
                detail: {
                    errMsg: e.message
                }
            }));
        };
    }

    function onNewValue(self, newval) {
        self.$src = newval;
        self.classList.remove("loaded");
        setTimeout(function () {
            self.$ele.img.src = newval;
            self.loaded = false;
        }, 0);
    }

    document.auiDefineElement('aux-image', {
        template: template,
        props: {
            src: {
                afterCreated: function afterCreated(self, newval) {
                    onNewValue(self, newval);
                },
                observer: function observer(self, oldval, newval) {
                    onNewValue(self, newval);
                }
            }
        },
        created: function created(self) {
            self.loaded = false;
            self.$onImageLoaded = onImageLoaded(self);
            self.$onImageError = onImageError(self);
            self.$ele.lay = self.children[1];
            self.$ele.img = self.children[2];
        },
        attached: function attached(self) {
            self.$ele.img.addEventListener("load", self.$onImageLoaded);
            self.$ele.img.addEventListener("error", self.$onImageError);
        },
        attrChanged: function attrChanged(self, name, oldval, newval) {}
    });
})();
},{}]},{},[1])